{include file="layout/layout" /}
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <div class="subject">
        <h3>文章管理</h3>
        <h5>网站系统文章索引与管理</h5>
      </div>
    </div>
  </div>
  <!-- 操作说明 -->
  <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
    <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
      <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
      <span title="收起提示" id="explanationZoom" style="display: block;"></span>
    </div>
    <ul>
      <li>文章管理, 由总平台设置管理.</li>
    </ul>
  </div>
  <div class="flexigrid">
    <div class="mDiv">
      <div class="ftitle">
        <h3>文章列表</h3>
        <h5>(共{$articlecount}条记录)</h5>
      </div>
      <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
    <form class="navbar-form form-inline" action="{:url('articleList')}" method="post">
      <div class="sDiv">
        <div class="sDiv2">
          <select name="art_cat_id" class="select">
            <option value="">选择文章类别</option>
              {foreach $articlecat as $v}
              <option value={$v.cat_id} >{$v.cat_name}</option>
              {/foreach}
          </select>
          <input size="30" name="art_title" class="qsbox" placeholder="标题搜索..." type="text">
          <input class="btn" value="搜索" type="submit">
        </div>
      </div>
     </form>
    </div>
    <div class="hDiv">
      <div class="hDivBox">
        <table cellspacing="0" cellpadding="0">
          <thead>
            <tr>
              <th class="sign" axis="col0">
                <div style="width: 24px;"><i class="ico-check"></i></div>
              </th>
              <th abbr="article_title" axis="col3" class="" align="center">
                <div style="text-align: center; width: 40px;" class="">文章ID</div>
              </th>
              <th abbr="article_title" axis="col3" class="" align="center">
                <div style="text-align: center; width: 120px;" class="">标题</div>
              </th>
              <th abbr="article_title" axis="col3" class="" align="center">
                <div style="text-align: center; width: 120px;" class="">摘要</div>
              </th>
              <th abbr="ac_id" axis="col4" class="" align="center">
                <div style="text-align: center; width: 80px;" class="">文章分类</div>
              </th>
              <th abbr="article_show" axis="col5" class="" align="center">
                <div style="text-align: center; width: 80px;" class="">作者</div>
              </th>
              <th abbr="article_show" axis="col5" class="" align="center">
                <div style="text-align: center; width: 120px;" class="">缩略图</div>
              </th>
              <th abbr="article_show" axis="col5" class="" align="center">
                <div style="text-align: center; width: 80px;" class="">点击量</div>
              </th>
              <th abbr="article_time" axis="col6" class="" align="center">
                <div style="text-align: center; width: 120px;" class="">发布时间</div>
              </th>
              <th axis="col1" class="handle" align="center">
                <div style="text-align: center; width: 150px;">操作</div>
              </th>
              <th style="width:100%" axis="col7">
                <div></div>
              </th>
            </tr>
          </thead>
        </table>
      </div>
    </div>
    <div class="tDiv">
      <div class="tDiv2">
          <div class="fbutton">
          <a href={:url('articleAddEdit')}><div class="add" title="新增文章"><span><i class="fa fa-plus"></i>新增文章</span></div></a>
          </div>
          <!-- <div class="fbutton"><div class="del" title="将选定行数据批量删除"><span><i class="fa fa-trash"></i>批量删除</span></div></div>-->
      </div>
      <div style="clear:both"></div>
    </div>
    <div class="bDiv" style="height: auto;">
      <div id="flexigrid" cellpadding="0" cellspacing="0" border="0">
        <table>
          <tbody>
            <!-- <td class="" align="center">
                  <div style="text-align: center; width: 80px;">
                    <span class="yes" onclick="changeTableVal('Article','article_id','7','is_open',this)"><i class="fa fa-check-circle"></i>是</span>
                  </div>
                </td> -->
            {foreach $articlelist as $v}
            <tr>
                <td class="sign">
                  <div style="width: 24px;"><i class="ico-check"></i></div>
                </td>
                <td class="" align="center">
                  <div style="text-align: center; width: 40px;">{$v.art_id}</div>
                </td>
                <td class="" align="center">
                  <div style="text-align: center; width: 120px;">{$v.art_title}</div>
                </td>
                <td class="" align="center">
                  <div style="text-align: center; width: 120px;">{$v.art_desc}</div>
                </td>
                <td class="" align="center">
                  <div style="text-align: center; width: 80px;">{$v.cat_name}</div>
                </td>
                <td class="" align="center">
                  <div style="text-align: center; width: 80px;">{$v.art_author}</div>
                </td>
                <td class="" align="center">
                  <div style="text-align: center; width: 120px;"><center><img onclick="showBigImg(this)" src="__ROOT__{$v.art_img}" style="width: 50px;" /></center></div>
                </td>
                <td class="" align="center">
                  <div style="text-align: center; width: 80px;">{$v.art_click}</div>
                </td>
                <td class="" align="center">
                  <div style="text-align: center; width: 120px;">{$v.art_addtime}</div>
                </td>
                <td class="handle" align="center">
                  <div style="text-align: center; width: 150px; max-width:150px;">
                    <a class="btn red" onclick="articleDel(this)" art_id="{$v.art_id}" ><i class="fa fa-trash-o"></i>删除</a>
                    <a class="btn blue" href="{:url('articleAddEdit',['art_id' => $v.art_id])}"><i class="fa fa-pencil-square-o"></i>编辑</a>
                  </div>
                </td>
                <td class="" style="width: 100%;" align="">
                  <div>&nbsp;</div>
                </td>
              </tr>
              {/foreach}
            </tbody>
        </table>
      </div>
      <div class="iDiv" style="display: none;"></div>
    </div>
    <!--分页位置-->
    <center>{$articlelist->render()|raw}</center>
</div>
</body></html>

<script type="text/javascript">
function articleDel(obj) {
    var art_id = $(obj).attr('art_id');
    layer.confirm('确定删除文章吗？', {
        btn: ['确定', '取消'],
        icon: 3
    },
    function() {
        $.post('articleDel', {
            'art_id': art_id
        },
        function(data) {
            if (data == 1) {
                layer.msg('删除成功', {
                    time: 2000,
                    icon: 1
                },
                function() {
                    window.location.reload();
                });
            }
            if (data == 2) {
                layer.msg('删除失败', {
                    time: 2000,
                    icon: 2
                });
            }
        });
    },
    function() {
        layer.msg('取消成功!', {
            time: 2000,
            icon: 0
        });
    });
}

function showBigImg(obj) {
    var objurl = $(obj).attr('src');
    layer.open({
        type: 1,
        title: false,
        closeBtn: 0,
        area: '700px',
        skin: 'layui-layer-nobg',
        shadeClose: true,
        content: "<img src=" + objurl + " width='700px' />"
    });
}
</script>
